# Python 2.6.4
# Project Euler, Problem 63
# Copyright 2010 Talha Zaman

count = 0
for i in range(1,10):
    j=1
    while (len(str(i**j))==j): count, j = count+1, j+1
print count
